<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
</body>
<script>
    function Person(name,age){
        this.name = name;
        this.age = age;
        this.sayHello = function(){
            console.log('hello');
        }
    }
    //在原型链上层写方法，可以让大家共用方法，从而节省内存空间
    Person.prototype.sayBye = function(){
        console.log('bye!bye!')
    }
    var person1  =  new Person('zhang',31);
    var person2 = new Person('li',22);
    
    console.log(person1);
    console.log(person2);
    console.log(person1.__proto__ === Person.prototype);

    console.log(Person.prototype.constructor == Person);
</script>
</html>